package Thread;

/**
 * Created with IntelliJ IDEA.
 * Description: Thread构造方法测试
 */
class MyThread7 extends Thread {
    public MyThread7(String name) {
        super(name);
    }

    @Override
    public void run() {
        System.out.println("线程名为" + this.getName());
    }
}

public class ThreadDemo7 {
    public static void main(String[] args) {
        Thread thread1 = new MyThread7("线程一");
        thread1.start();
        Thread thread2 = new Thread(() -> System.out.println("hello"), "线程二");
        thread2.start();
        System.out.println(thread2.getName());
    }
}
